home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / FreshBar / Source / Bar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-29  |  3.8 KB  |  137 lines

  1. //****************************************************************//
  2. // Filename:    Bar.h
  3. // Autor:       Christian Taulien of Strange Intelligence
  4. // Purpose:     Definition of Bar management classes for FreshBar
  5. // Creation:    17. Mai 1998
  6. //****************************************************************//
  7. #ifndef TAULIEN_BAR_H
  8. #define TAULIEN_BAR_H
  9.  
  10. #include <exec/types.h>
  11. #include <exec/nodes.h>
  12. #include <exec/lists.h>
  13.  
  14. #include "global.h"
  15. #include "SIFC_Strings.h"
  16.  
  17. class BarListC;
  18. class BarWindowNodeC;
  19. class TextMeasureC;
  20.  
  21. //*************************************************************************//
  22. //.klasse
  23. //KLASSENNAME   : BarNodeC
  24. //VERSION       : 17. Mai 1998
  25. //AUTOR         : Taulien
  26. //AUFGABE       : Eine Klasse zur Verwaltung eines Balkens (ProgressBar)
  27. //DOKUMENTATION : -
  28. //BEMERKUNGEN   : -
  29. //AENDERUNGEN   : -
  30. //*************************************************************************//
  31. class BarNodeC : public struct Node
  32. {
  33.   friend class BarListC;
  34.  
  35. public:
  36.   enum ProgressMode
  37.   {
  38.     PM_None,
  39.     PM_Percent,
  40.     PM_Absolute
  41.   };
  42.  
  43. private:
  44.   // ## datamembers ##
  45.   StringC      m_oName;
  46.   ULONG        m_ulID;
  47.   ULONG        m_ulMaxValue;
  48.   ULONG        m_ulCurrentValue;
  49.   BOOL         m_bShowPercent;
  50.   int          m_iPen;
  51.   int          m_iBPen;
  52.   ProgressMode m_eProgressMode;
  53.  
  54.   static ULONG m_ulNextFreeID;
  55.  
  56.   // ## methods
  57.   BarNodeC(BarListC *arg_poBarList, char *arg_sName, ULONG arg_ulMaxValue=100);
  58.   void drawBar(BarWindowNodeC *arg_poBWNode,
  59.                TextMeasureC *arg_poTeMe,
  60.                ULONG arg_ulPosX,
  61.                ULONG arg_ulPosY,
  62.                ULONG arg_ulBarBreite,
  63.                ULONG arg_ulBreite,
  64.                ULONG arg_ulHoehe);
  65.  
  66.   void fillBar(struct RastPort *arg_poRPort,
  67.                TextMeasureC *arg_poTeMe,
  68.                ULONG arg_ulPosX,
  69.                ULONG arg_ulPosY,
  70.                ULONG arg_ulBarBreite,
  71.                ULONG arg_ulBreite,
  72.                ULONG arg_ulHoehe);
  73. public:
  74.   // ## datamembers
  75.  
  76.   // ## methods
  77.   ~BarNodeC();
  78.  
  79.   StringC getName(void) { return m_oName; }
  80.   ULONG   getBarID()    { return m_ulID;  }
  81.   void setMaxVal(ULONG arg_ulValue)
  82.       { m_ulMaxValue = arg_ulValue; }
  83.   void setCurrentVal(ULONG arg_ulValue)
  84.       { m_ulCurrentValue = arg_ulValue; }
  85.   void setProgressMode(ProgressMode arg_eMode)
  86.       { m_eProgressMode = arg_eMode; }
  87.   void setFillPen(int arg_iFillPen)
  88.       { m_iPen = arg_iFillPen; }
  89.   void setBackPen(int arg_iBackPen)
  90.       { m_iBPen = arg_iBackPen; }
  91.   BarNodeC *getNext(void);
  92.   BarNodeC *getPrev(void);
  93. };
  94.  
  95. //*************************************************************************//
  96. //.klasse
  97. //KLASSENNAME   : BarListC
  98. //VERSION       : 17. Mai 1998
  99. //AUTOR         : Taulien
  100. //AUFGABE       : Eine Klasse für die Verwaltung von verschiedenen Balken
  101. //DOKUMENTATION : -
  102. //BEMERKUNGEN   : -
  103. //AENDERUNGEN   : -
  104. //*************************************************************************//
  105. class BarListC : public struct List
  106. {
  107. private:
  108.   // ## private datamembers ##
  109.   int m_iBarWidth;
  110.  
  111. public:
  112.   BarListC();
  113.   ~BarListC();
  114.  
  115.   BarNodeC *addBar(char *arg_sName, ULONG arg_ulMaxValue = 100);
  116.   void  removeBar(ULONG arg_ulBarID);
  117.   void  removeAll();
  118.  
  119.   BarNodeC *findBarNode(ULONG arg_ulBarID);
  120.   BarNodeC *getFirst() { return (BarNodeC *) lh_Head; }
  121.   int indexOf(BarNodeC *arg_poNode);
  122.   int getSize();
  123.  
  124.   BarNodeC *operator[](int arg_iIndex);
  125.  
  126.   int getBarWidth() { return m_iBarWidth; }
  127.   void setBarWidth(int arg_iBarWidth) { m_iBarWidth = arg_iBarWidth; }
  128.   int getHeight(struct Screen *arg_poScreen);
  129.   int getWidth(struct Screen *arg_poScreen);
  130.   int getBarTitleWidth(struct Screen *arg_poScreen);
  131.   void drawBars(BarWindowNodeC *arg_poBWNode, ULONG arg_ulPosX, ULONG arg_ulPosY);
  132.   void fillBars(BarWindowNodeC *arg_poBWNode, ULONG arg_ulPosX, ULONG arg_ulPosY);
  133. };
  134.  
  135. #endif // TAULIEN_BAR_H
  136.  
  137.